package com.deparse.testapp;

import com.google.gson.Gson;

import java.lang.reflect.Type;

/**
 * Created by MartinDKent on 2016/1/16.
 */
public class GsonUtil {
    private static Gson gson;

    static {
        gson = new Gson();
    }

    public static <T> T fromJson(String json, Class<T> cls) {
        return gson.fromJson(json, cls);
    }

    public static <T> T fromJson(String json, Type typeOfT) {
        return gson.fromJson(json, typeOfT);
    }

    public static String toJson(Object src) {
        return gson.toJson(src);
    }
}
